<template>
	<div>
		<el-form :inline="true" :model="queryParams" class="demo-form-inline">
			<el-form-item label="">
				<el-input v-model="queryParams.name" placeholder="菜单名"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="queryAll()">查询</el-button>
			</el-form-item>

			<!-- <el-form-item>
				<el-button type="primary" @click="dialogFormVisible = true">添加</el-button>
			</el-form-item> -->

		</el-form>
		<el-table :data="menuData" style="width: 100%;margin-bottom: 20px;" row-key="id" border>
			<el-table-column prop="id" label="id" width="180">
			</el-table-column>
			<el-table-column prop="path" label="前端请求url">
			</el-table-column>
			<el-table-column prop="component" label="组件">
			</el-table-column>
			<el-table-column prop="name" label="菜单名">
			</el-table-column>
			<el-table-column prop="iconCls" label="图标">
			</el-table-column>
			<el-table-column prop="parentId" label="父级id">
			</el-table-column>
			<el-table-column prop="enabled" label="是否启用">
				<template slot-scope="{row}">
					<el-switch v-model="row.enabled === 1" active-color="#13ce66" inactive-color="#ff4949">
					</el-switch>
				</template>
			</el-table-column>
		</el-table>


	</div>
</template>

<script>
	export default {
		data() {
			return {
				menuData: [],
				queryParams: {
					name: ""
				},
			}
		},
		mounted() {
			this.initMenuData();
		},
		methods: {
			initMenuData() {
				this.$postRequest("/tMenu/tMenuList").then(res => {

					this.menuData = res.data.tMenuList;
				});
			},
			//模糊查询
			queryAll() {
				this.$postRequest("/tMenu/queryAll", this.queryParams.name).then(res => {
					console.log(this.queryParams.name)
					this.menuData = res.data.tMenuList
				})
			},
		},
	}
</script>

<style>
</style>